
#include    <stdio.h>

#include    "cppsocket/udpnode.h"
#include    "cppsocket/stringbuffer.h"

using namespace CPPSocket;


static    int    sg_iPort = 3721;    
static    int    sg_iMaxTimes = 100;
   
int    main( int argc, char* argv[] )
{

    UDPNode    udper;
    
    udper.open(sg_iPort);

    for(int i=0; i<sg_iMaxTimes; i++) {
        Address   address;
        StringBuffer    data;
        udper.recvfrom(address, data);
        
        fprintf(stdout, "#%-8d get '%s', and echoing ...\n", i+1, data.c_str());
        udper.sendto(address, data);
    }
        
    udper.close();
    
    return    0;
}

